# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[GenericContainer.__init__(self, name, type_='parameter', **kw)
self.parent = parent
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f41cc>}
nname: 73
n 73(None)[del _[1]
return xrange(4)
]:
	i: 0(AF), 20()
	o: 

nname: 20
n 20(None)[for i in xrange(4):
]:
	i: 0(for)
	o: 73()

nname: 0
n 0(None)[]:
	i: 
	o: 20(for), 73(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f486c>, 73: <unpyclib.structure.node instance at 0xb75f44ec>, 20: <unpyclib.structure.node instance at 0xb75f44cc>}
nname: 6
n 6(None)[def __init__(self, name, parent, **kw):
	GenericContainer.__init__(self, name, type_='parameter', **kw)
	self.parent = parent

def browse(self):
	pass

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75facec>}
nname: 0
n 0(None)[UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f4cac>}
nname: 6
n 6(None)[__doc__ = "Record a list of 4 integers (0 to 10) in user_config\n    (at 'security' configuration class)\n    "
translation_dict = {}
def __init__(self, domain, key, *args, **args):
	UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
	self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fae8c>}
nname: 0
n 0(None)[UserConfigSetupCheckMultipleItem.__init__(self, domain, key, *args, **kw)
self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f444c>}
nname: 6
n 6(None)[translation_dict = {}
def __init__(self, domain, key, *args, **args):
	UserConfigSetupCheckMultipleItem.__init__(self, domain, key, *args, **kw)
	self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fadcc>}
nname: 0
n 0(None)[ActionItem.__init__(self, name, type_, action=self._launch_secret_menu)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f4b0c>}
nname: 0
n 0(None)[SecretCodeSetupParametersMenu(name=_('Code PIN')).show(hide_previous_menu=False)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f40cc>}
nname: 6
n 6(None)[def __init__(self, name, type_):
	ActionItem.__init__(self, name, type_, action=self._launch_secret_menu)

def _launch_secret_menu(self):
	SecretCodeSetupParametersMenu(name=_('Code PIN')).show(hide_previous_menu=False)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fab2c>}
nname: 0
n 0(None)[ActionItem.__init__(self, name, type_, action=self._launch_qa_menu)
self._check = check
self._end_action = end_action
self._end_action_args = end_action_args
self._end_action_kw = end_action_kw
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f4c4c>}
nname: 0
n 0(None)[QuestionAnswerSetupParametersLauncher(self._check, self._end_action, self._end_action_args, self._end_action_kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f452c>}
nname: 6
n 6(None)[def __init__(self, name, type_, check=True, end_action=None, end_action_args=(), end_action_kw={}):
	ActionItem.__init__(self, name, type_, action=self._launch_qa_menu)
	self._check = check
	self._end_action = end_action
	self._end_action_args = end_action_args
	self._end_action_kw = end_action_kw

def _launch_qa_menu(self):
	QuestionAnswerSetupParametersLauncher(self._check, self._end_action, self._end_action_args, self._end_action_kw)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fad2c>}
nname: 0
n 0(None)[self._reload_center = reload_center
BooleanUserConfigSetupItem.__init__(self, *args, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f444c>}
nname: 30
n 30(None)[]:
	i: 9(), 29()
	o: 

nname: 29
n 29(None)[]:
	i: 0(f)
	o: 30()

nname: 9
n 9(None)[self.reload_center_list(rebuild=True)
]:
	i: 0(t)
	o: 30()

nname: 0
n 0(self._reload_center)[]:
	i: 
	o: 9(t), 29(f)

nname: 0
n 0(None)[if self._reload_center:
	self.reload_center_list(rebuild=True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ff52c>}
nname: 139
n 139(None)[return None
]:
	i: 52(), 118(), 138()
	o: 

nname: 138
n 138(None)[]:
	i: 108(f)
	o: 139()

nname: 118
n 118(None)[self.reload_center_list(rebuild=True)
]:
	i: 108(t)
	o: 139()

nname: 108
n 108(self._reload_center)[]:
	i: 0&6(f)
	o: 118(t), 138(f)

nname: 52
n 52(None)[self.menu.first_parental = True
def _reload_when_ok():
	if self._reload_center:
		self.reload_center_list(rebuild=True)

self.menu.end_func = _reload_when_ok
self.menu.on_first_parental_control()
]:
	i: 0&6(t)
	o: 139()

nname: 0&6
n 0&6(val and (user_config['security']['secretcode'], user_config['security']['question'], user_config['security']['answer']) == (None, None, None))[]:
	i: 
	o: 52(t), 108(f)

nname: 0&6
n 0&6(None)[if val and (user_config['security']['secretcode'], user_config['security']['question'], user_config['security']['answer']) == (None, None, None):
	self.menu.first_parental = True
	def _reload_when_ok():
		if self._reload_center:
			self.reload_center_list(rebuild=True)

	self.menu.end_func = _reload_when_ok
	self.menu.on_first_parental_control()
else:
	if self._reload_center:
		self.reload_center_list(rebuild=True)
return None
]:
	i: 
	o: 

self.nodes: {'0&6': <unpyclib.structure.node instance at 0xb75f472c>}
nname: 6
n 6(None)[def __init__(self, reload_center=True, *args, **args):
	self._reload_center = reload_center
	BooleanUserConfigSetupItem.__init__(self, *args, **kw)

def execute_action(self, val):
	if val and (user_config['security']['secretcode'], user_config['security']['question'], user_config['security']['answer']) == (None, None, None):
		self.menu.first_parental = True
		def _reload_when_ok():
			if self._reload_center:
				self.reload_center_list(rebuild=True)

		self.menu.end_func = _reload_when_ok
		self.menu.on_first_parental_control()
	else:
		if self._reload_center:
			self.reload_center_list(rebuild=True)
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fad6c>}
nname: 31
n 31(None)[self._reload_center = reload_center
UserConfigSetupItem.__init__(self, domain, key, choices, **kw)
]:
	i: 14(), 24()
	o: 

nname: 24
n 24(None)[choices = choices
]:
	i: 0(t)
	o: 31()

nname: 14
n 14(None)[choices = []
]:
	i: 0(f)
	o: 31()

nname: 0
n 0(user_config['security']['parental_control'])[]:
	i: 
	o: 14(f), 24(t)

nname: 0
n 0(None)[if not user_config['security']['parental_control']:
	choices = []
else:
	choices = choices
self._reload_center = reload_center
UserConfigSetupItem.__init__(self, domain, key, choices, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f45ac>}
nname: 30
n 30(None)[]:
	i: 9(), 29()
	o: 

nname: 29
n 29(None)[]:
	i: 0(f)
	o: 30()

nname: 9
n 9(None)[self.reload_center_list(rebuild=True)
]:
	i: 0(t)
	o: 30()

nname: 0
n 0(self._reload_center)[]:
	i: 
	o: 9(t), 29(f)

nname: 0
n 0(None)[if self._reload_center:
	self.reload_center_list(rebuild=True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f406c>}
nname: 6
n 6(None)[__doc__ = "\n    This class is the mother for all those are browseable when\n    parental_control is activated and are 'empty' when it is deactivated\n    "
def __init__(self, domain, key, choices, reload_center=True, **kw):
	if not user_config['security']['parental_control']:
		choices = []
	else:
		choices = choices
	self._reload_center = reload_center
	UserConfigSetupItem.__init__(self, domain, key, choices, **kw)

def execute_action(self, val):
	if self._reload_center:
		self.reload_center_list(rebuild=True)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fafcc>}
nname: 0
n 0(None)[ActionItem.__init__(self, action=self.execute_action, *args, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f42ec>}
nname: 0
n 0(None)[from pygui.markerlist import markerlists
user_config['security']['parent_mode'] = False
user_config.save()
pygui_globs['menustack'].back_to_home()
markerlists().clear_all_markerlists()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f488c>}
nname: 6
n 6(None)[def __init__(self, *args, **args):
	ActionItem.__init__(self, action=self.execute_action, *args, **kw)

def execute_action(self):
	from pygui.markerlist import markerlists
	user_config['security']['parent_mode'] = False
	user_config.save()
	pygui_globs['menustack'].back_to_home()
	markerlists().clear_all_markerlists()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fac2c>}
nname: 6
n 6(None)[translation_dict = UnicodeDict({0: 'No rating', 10: '-10 years', 12: '10 - 12 years', 16: '12 - 16 years', 18: '16 - 18 years'})
]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75faf2c>}
nname: 0
n 0(None)[ParametersSetupItem.__init__(self, *args, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f44ec>}
nname: 286
n 286(None)[return preview_list
]:
	i: 235(), 285()
	o: 

nname: 285
n 285(None)[]:
	i: 221(f)
	o: 286()

nname: 235
n 235(None)[preview_list.append(ParentalRatingConfigSetupItem(domain='security', key='maturity_rating', choices=(0, 10, 12, 16, 18), name='Parental rating', type_='setupitem'))
]:
	i: 221(t)
	o: 286()

nname: 221
n 221(user_config['security']['parental_control'])[]:
	i: 155(), 220()
	o: 235(t), 285(f)

nname: 220
n 220(None)[]:
	i: 110(f)
	o: 221()

nname: 155
n 155(None)[preview_list.extend([SecretCodeParameters(name=_('Modify Secret Code'), type_='parameters'), QuestionAnswerParameters(name=_('Modify Question / Answer'), type_='parameters')])
]:
	i: 110(t)
	o: 221()

nname: 110
n 110((user_config['security']['answer'], user_config['security']['question'], user_config['security']['secretcode']) != (None, None, None))[]:
	i: 62(), 109()
	o: 155(t), 220(f)

nname: 109
n 109(None)[]:
	i: 0(f)
	o: 110()

nname: 62
n 62(None)[preview_list.append(ParentModeConfigSetupItem(name=_('Set to child mode'), type_='setupitem', menu=self.menu))
]:
	i: 0(t)
	o: 110()

nname: 0
n 0(user_config['security']['parental_control'])[preview_list = [ParentalControlConfigSetupItem(domain='security', key='parental_control', choices_list=(True, False), name='Parental control', type_='setupitem')]
]:
	i: 
	o: 62(t), 109(f)

nname: 221
n 221(None)[if user_config['security']['parental_control']:
	preview_list.append(ParentalRatingConfigSetupItem(domain='security', key='maturity_rating', choices=(0, 10, 12, 16, 18), name='Parental rating', type_='setupitem'))
return preview_list
]:
	i: 0()
	o: 

nname: 0
n 0(None)[preview_list = [ParentalControlConfigSetupItem(domain='security', key='parental_control', choices_list=(True, False), name='Parental control', type_='setupitem')]
if user_config['security']['parental_control']:
	preview_list.append(ParentModeConfigSetupItem(name=_('Set to child mode'), type_='setupitem', menu=self.menu))
if (user_config['security']['answer'], user_config['security']['question'], user_config['security']['secretcode']) != (None, None, None):
	preview_list.extend([SecretCodeParameters(name=_('Modify Secret Code'), type_='parameters'), QuestionAnswerParameters(name=_('Modify Question / Answer'), type_='parameters')])
]:
	i: 
	o: 221()

nname: 0
n 0(None)[preview_list = [ParentalControlConfigSetupItem(domain='security', key='parental_control', choices_list=(True, False), name='Parental control', type_='setupitem')]
if user_config['security']['parental_control']:
	preview_list.append(ParentModeConfigSetupItem(name=_('Set to child mode'), type_='setupitem', menu=self.menu))
if (user_config['security']['answer'], user_config['security']['question'], user_config['security']['secretcode']) != (None, None, None):
	preview_list.extend([SecretCodeParameters(name=_('Modify Secret Code'), type_='parameters'), QuestionAnswerParameters(name=_('Modify Question / Answer'), type_='parameters')])
if user_config['security']['parental_control']:
	preview_list.append(ParentalRatingConfigSetupItem(domain='security', key='maturity_rating', choices=(0, 10, 12, 16, 18), name='Parental rating', type_='setupitem'))
return preview_list
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75fff0c>}
nname: 6
n 6(None)[depth = 3
def __init__(self, *args, **args):
	ParametersSetupItem.__init__(self, *args, **kw)

def browse(self):
	preview_list = [ParentalControlConfigSetupItem(domain='security', key='parental_control', choices_list=(True, False), name='Parental control', type_='setupitem')]
	if user_config['security']['parental_control']:
		preview_list.append(ParentModeConfigSetupItem(name=_('Set to child mode'), type_='setupitem', menu=self.menu))
	if (user_config['security']['answer'], user_config['security']['question'], user_config['security']['secretcode']) != (None, None, None):
		preview_list.extend([SecretCodeParameters(name=_('Modify Secret Code'), type_='parameters'), QuestionAnswerParameters(name=_('Modify Question / Answer'), type_='parameters')])
	if user_config['security']['parental_control']:
		preview_list.append(ParentalRatingConfigSetupItem(domain='security', key='maturity_rating', choices=(0, 10, 12, 16, 18), name='Parental rating', type_='setupitem'))
	return preview_list

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75fad8c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from pygui.item.containers import GenericContainer
from pygui.item.parameters import UserConfigSetupMultipleItem, IterItemContainer, UserConfigSetupItem, ParametersSetupItem, BooleanUserConfigSetupItem
from pygui.item.core import ActionItem
from pygui.shared import pygui_globs
from pygui.config import user_config
from pygui.facilities.l10n import UnicodeDict
class SecretCodeContainer(GenericContainer):
	def __init__(self, name, parent, **kw):
		GenericContainer.__init__(self, name, type_='parameter', **kw)
		self.parent = parent

	def browse(self):
		pass



class SecretCodeUserConfigSetupItem(UserConfigSetupMultipleItem):
	__doc__ = "Record a list of 4 integers (0 to 10) in user_config\n    (at 'security' configuration class)\n    "
	translation_dict = {}
	def __init__(self, domain, key, *args, **args):
		UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
		self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()



from ..core import UserConfigSetupCheckMultipleItem
class SecretCodeCheckConfigSetupItem(UserConfigSetupCheckMultipleItem):
	translation_dict = {}
	def __init__(self, domain, key, *args, **args):
		UserConfigSetupCheckMultipleItem.__init__(self, domain, key, *args, **kw)
		self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()



class SecretCodeParameters(ActionItem):
	def __init__(self, name, type_):
		ActionItem.__init__(self, name, type_, action=self._launch_secret_menu)

	def _launch_secret_menu(self):
		SecretCodeSetupParametersMenu(name=_('Code PIN')).show(hide_previous_menu=False)



class QuestionAnswerParameters(ActionItem):
	def __init__(self, name, type_, check=True, end_action=None, end_action_args=(), end_action_kw={}):
		ActionItem.__init__(self, name, type_, action=self._launch_qa_menu)
		self._check = check
		self._end_action = end_action
		self._end_action_args = end_action_args
		self._end_action_kw = end_action_kw

	def _launch_qa_menu(self):
		QuestionAnswerSetupParametersLauncher(self._check, self._end_action, self._end_action_args, self._end_action_kw)



class ParentalControlConfigSetupItem(BooleanUserConfigSetupItem):
	def __init__(self, reload_center=True, *args, **args):
		self._reload_center = reload_center
		BooleanUserConfigSetupItem.__init__(self, *args, **kw)

	def execute_action(self, val):
		if val and (user_config['security']['secretcode'], user_config['security']['question'], user_config['security']['answer']) == (None, None, None):
			self.menu.first_parental = True
			def _reload_when_ok():
				if self._reload_center:
					self.reload_center_list(rebuild=True)

			self.menu.end_func = _reload_when_ok
			self.menu.on_first_parental_control()
		else:
			if self._reload_center:
				self.reload_center_list(rebuild=True)
		return None



class ParentalDependantSetupItem(UserConfigSetupItem):
	__doc__ = "\n    This class is the mother for all those are browseable when\n    parental_control is activated and are 'empty' when it is deactivated\n    "
	def __init__(self, domain, key, choices, reload_center=True, **kw):
		if not user_config['security']['parental_control']:
			choices = []
		else:
			choices = choices
		self._reload_center = reload_center
		UserConfigSetupItem.__init__(self, domain, key, choices, **kw)

	def execute_action(self, val):
		if self._reload_center:
			self.reload_center_list(rebuild=True)



class ParentModeConfigSetupItem(ActionItem):
	def __init__(self, *args, **args):
		ActionItem.__init__(self, action=self.execute_action, *args, **kw)

	def execute_action(self):
		from pygui.markerlist import markerlists
		user_config['security']['parent_mode'] = False
		user_config.save()
		pygui_globs['menustack'].back_to_home()
		markerlists().clear_all_markerlists()



class ParentalRatingConfigSetupItem(ParentalDependantSetupItem):
	translation_dict = UnicodeDict({0: 'No rating', 10: '-10 years', 12: '10 - 12 years', 16: '12 - 16 years', 18: '16 - 18 years'})


class ProtectionParametersSetupItem(ParametersSetupItem):
	depth = 3
	def __init__(self, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)

	def browse(self):
		preview_list = [ParentalControlConfigSetupItem(domain='security', key='parental_control', choices_list=(True, False), name='Parental control', type_='setupitem')]
		if user_config['security']['parental_control']:
			preview_list.append(ParentModeConfigSetupItem(name=_('Set to child mode'), type_='setupitem', menu=self.menu))
		if (user_config['security']['answer'], user_config['security']['question'], user_config['security']['secretcode']) != (None, None, None):
			preview_list.extend([SecretCodeParameters(name=_('Modify Secret Code'), type_='parameters'), QuestionAnswerParameters(name=_('Modify Question / Answer'), type_='parameters')])
		if user_config['security']['parental_control']:
			preview_list.append(ParentalRatingConfigSetupItem(domain='security', key='maturity_rating', choices=(0, 10, 12, 16, 18), name='Parental rating', type_='setupitem'))
		return preview_list



from pygui.menu.menu.parameters import SecretCodeSetupParametersMenu
from pygui.menu.menu.security import QuestionAnswerSetupParametersLauncher
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb766b3ac>}
from __future__ import absolute_import
from pygui.item.containers import GenericContainer
from pygui.item.parameters import UserConfigSetupMultipleItem, IterItemContainer, UserConfigSetupItem, ParametersSetupItem, BooleanUserConfigSetupItem
from pygui.item.core import ActionItem
from pygui.shared import pygui_globs
from pygui.config import user_config
from pygui.facilities.l10n import UnicodeDict
class SecretCodeContainer(GenericContainer):
	def __init__(self, name, parent, **kw):
		GenericContainer.__init__(self, name, type_='parameter', **kw)
		self.parent = parent

	def browse(self):
		pass



class SecretCodeUserConfigSetupItem(UserConfigSetupMultipleItem):
	__doc__ = "Record a list of 4 integers (0 to 10) in user_config\n    (at 'security' configuration class)\n    "
	translation_dict = {}
	def __init__(self, domain, key, *args, **args):
		UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
		self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()



from ..core import UserConfigSetupCheckMultipleItem
class SecretCodeCheckConfigSetupItem(UserConfigSetupCheckMultipleItem):
	translation_dict = {}
	def __init__(self, domain, key, *args, **args):
		UserConfigSetupCheckMultipleItem.__init__(self, domain, key, *args, **kw)
		self.preview_list = SecretCodeContainer('Code', menu=self.menu, parent=self).browse()



class SecretCodeParameters(ActionItem):
	def __init__(self, name, type_):
		ActionItem.__init__(self, name, type_, action=self._launch_secret_menu)

	def _launch_secret_menu(self):
		SecretCodeSetupParametersMenu(name=_('Code PIN')).show(hide_previous_menu=False)



class QuestionAnswerParameters(ActionItem):
	def __init__(self, name, type_, check=True, end_action=None, end_action_args=(), end_action_kw={}):
		ActionItem.__init__(self, name, type_, action=self._launch_qa_menu)
		self._check = check
		self._end_action = end_action
		self._end_action_args = end_action_args
		self._end_action_kw = end_action_kw

	def _launch_qa_menu(self):
		QuestionAnswerSetupParametersLauncher(self._check, self._end_action, self._end_action_args, self._end_action_kw)



class ParentalControlConfigSetupItem(BooleanUserConfigSetupItem):
	def __init__(self, reload_center=True, *args, **args):
		self._reload_center = reload_center
		BooleanUserConfigSetupItem.__init__(self, *args, **kw)

	def execute_action(self, val):
		if val and (user_config['security']['secretcode'], user_config['security']['question'], user_config['security']['answer']) == (None, None, None):
			self.menu.first_parental = True
			def _reload_when_ok():
				if self._reload_center:
					self.reload_center_list(rebuild=True)

			self.menu.end_func = _reload_when_ok
			self.menu.on_first_parental_control()
		else:
			if self._reload_center:
				self.reload_center_list(rebuild=True)
		return None



class ParentalDependantSetupItem(UserConfigSetupItem):
	__doc__ = "\n    This class is the mother for all those are browseable when\n    parental_control is activated and are 'empty' when it is deactivated\n    "
	def __init__(self, domain, key, choices, reload_center=True, **kw):
		if not user_config['security']['parental_control']:
			choices = []
		else:
			choices = choices
		self._reload_center = reload_center
		UserConfigSetupItem.__init__(self, domain, key, choices, **kw)

	def execute_action(self, val):
		if self._reload_center:
			self.reload_center_list(rebuild=True)



class ParentModeConfigSetupItem(ActionItem):
	def __init__(self, *args, **args):
		ActionItem.__init__(self, action=self.execute_action, *args, **kw)

	def execute_action(self):
		from pygui.markerlist import markerlists
		user_config['security']['parent_mode'] = False
		user_config.save()
		pygui_globs['menustack'].back_to_home()
		markerlists().clear_all_markerlists()



class ParentalRatingConfigSetupItem(ParentalDependantSetupItem):
	translation_dict = UnicodeDict({0: 'No rating', 10: '-10 years', 12: '10 - 12 years', 16: '12 - 16 years', 18: '16 - 18 years'})


class ProtectionParametersSetupItem(ParametersSetupItem):
	depth = 3
	def __init__(self, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)

	def browse(self):
		preview_list = [ParentalControlConfigSetupItem(domain='security', key='parental_control', choices_list=(True, False), name='Parental control', type_='setupitem')]
		if user_config['security']['parental_control']:
			preview_list.append(ParentModeConfigSetupItem(name=_('Set to child mode'), type_='setupitem', menu=self.menu))
		if (user_config['security']['answer'], user_config['security']['question'], user_config['security']['secretcode']) != (None, None, None):
			preview_list.extend([SecretCodeParameters(name=_('Modify Secret Code'), type_='parameters'), QuestionAnswerParameters(name=_('Modify Question / Answer'), type_='parameters')])
		if user_config['security']['parental_control']:
			preview_list.append(ParentalRatingConfigSetupItem(domain='security', key='maturity_rating', choices=(0, 10, 12, 16, 18), name='Parental rating', type_='setupitem'))
		return preview_list



from pygui.menu.menu.parameters import SecretCodeSetupParametersMenu
from pygui.menu.menu.security import QuestionAnswerSetupParametersLauncher
